local sk__hemou = fk.CreateSkill {

  name = "sk__hemou",

  tags = {  },

}



sk__hemou:addEffect(fk.EventPhaseStart, {
  name = "sk__hemou",
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    return target ~= player and player:hasSkill(sk__hemou.name) and target.phase == Player.Play and not target.dead and not player:isKongcheng()
  end,
  on_cost = function(self, event, target, player, data)
    local card = player.room:askForCard(player, 1, 1, false, sk__hemou.name, true, ".", "#sk__hemou-invoke::"..target.id)
    if #card > 0 then
      event:setCostData(self, card[1])
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:doIndicate(player.id, {target.id})
    room:moveCardTo(event:getCostData(self), Card.PlayerHand, target, fk.ReasonGive, sk__hemou.name, nil, false, player)
    if not target.dead then
      room:setPlayerMark(target, "sk__hemou-phase", event:getCostData(self))
      room:handleAddLoseSkills(target, "sk__hemou&", nil, false, true)
      local phase_event = room.logic:getCurrentEvent():findParent(GameEvent.Phase)
      if phase_event ~= nil then
        phase_event:addCleaner(function()
          room:handleAddLoseSkills(target, "-sk__hemou&", nil, false, true)
        end)
      end
    end
  end,
})

return sk__hemou